home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib / tk / bind.man < prev    next >
Encoding:
Text File  |  1992-08-24  |  19.6 KB  |  600 lines

  1. '\"
  2. '\" Copyright 1990 Regents of the University of California
  3. '\" Permission to use, copy, modify, and distribute this
  4. '\" documentation for any purpose and without fee is hereby
  5. '\" granted, provided that this notice appears in all copies.
  6. '\" The University of California makes no representations about
  7. '\" the suitability of this material for any purpose.  It is
  8. '\" provided "as is" without express or implied warranty.
  9. '\" 
  10. '\" $Header: /user6/ouster/wish/man/RCS/bind.man,v 1.16 92/06/01 09:21:39 ouster Exp $ SPRITE (Berkeley)
  11. '/" 
  12. .\" The definitions below are for supplemental macros used in Sprite
  13. .\" manual entries.
  14. .\"
  15. .\" .HS name section [date [version]]
  16. .\"    Replacement for .TH in other man pages.  See below for valid
  17. .\"    section names.
  18. .\"
  19. .\" .AP type name in/out [indent]
  20. .\"    Start paragraph describing an argument to a library procedure.
  21. .\"    type is type of argument (int, etc.), in/out is either "in", "out",
  22. .\"    or "in/out" to describe whether procedure reads or modifies arg,
  23. .\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  24. .\"    needed;  use .AS below instead)
  25. .\"
  26. .\" .AS [type [name]]
  27. .\"    Give maximum sizes of arguments for setting tab stops.  Type and
  28. .\"    name are examples of largest possible arguments that will be passed
  29. .\"    to .AP later.  If args are omitted, default tab stops are used.
  30. .\"
  31. .\" .BS
  32. .\"    Start box enclosure.  From here until next .BE, everything will be
  33. .\"    enclosed in one large box.
  34. .\"
  35. .\" .BE
  36. .\"    End of box enclosure.
  37. .\"
  38. .\" .VS
  39. .\"    Begin vertical sidebar, for use in marking newly-changed parts
  40. .\"    of man pages.
  41. .\"
  42. .\" .VE
  43. .\"    End of vertical sidebar.
  44. .\"
  45. .\" .DS
  46. .\"    Begin an indented unfilled display.
  47. .\"
  48. .\" .DE
  49. .\"    End of indented unfilled display.
  50. .\"
  51. '\"    # Heading for Sprite man pages
  52. .de HS
  53. .if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  54. .if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  55. .if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  56. .if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  57. .if t .wh -1.3i ^B
  58. .nr ^l \\n(.l
  59. .ad b
  60. ..
  61. '\"    # Start an argument description
  62. .de AP
  63. .ie !"\\$4"" .TP \\$4
  64. .el \{\
  65. .   ie !"\\$2"" .TP \\n()Cu
  66. .   el          .TP 15
  67. .\}
  68. .ie !"\\$3"" \{\
  69. .ta \\n()Au \\n()Bu
  70. \&\\$1    \\fI\\$2\\fP    (\\$3)
  71. .\".b
  72. .\}
  73. .el \{\
  74. .br
  75. .ie !"\\$2"" \{\
  76. \&\\$1    \\fI\\$2\\fP
  77. .\}
  78. .el \{\
  79. \&\\fI\\$1\\fP
  80. .\}
  81. .\}
  82. ..
  83. '\"    # define tabbing values for .AP
  84. .de AS
  85. .nr )A 10n
  86. .if !"\\$1"" .nr )A \\w'\\$1'u+3n
  87. .nr )B \\n()Au+15n
  88. .\"
  89. .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  90. .nr )C \\n()Bu+\\w'(in/out)'u+2n
  91. ..
  92. '\"    # BS - start boxed text
  93. '\"    # ^y = starting y location
  94. '\"    # ^b = 1
  95. .de BS
  96. .br
  97. .mk ^y
  98. .nr ^b 1u
  99. .if n .nf
  100. .if n .ti 0
  101. .if n \l'\\n(.lu\(ul'
  102. .if n .fi
  103. ..
  104. '\"    # BE - end boxed text (draw box now)
  105. .de BE
  106. .nf
  107. .ti 0
  108. .mk ^t
  109. .ie n \l'\\n(^lu\(ul'
  110. .el \{\
  111. .\"    Draw four-sided box normally, but don't draw top of
  112. .\"    box if the box started on an earlier page.
  113. .ie !\\n(^b-1 \{\
  114. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  115. .\}
  116. .el \}\
  117. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  118. .\}
  119. .\}
  120. .fi
  121. .br
  122. .nr ^b 0
  123. ..
  124. '\"    # VS - start vertical sidebar
  125. '\"    # ^Y = starting y location
  126. '\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
  127. .de VS
  128. .mk ^Y
  129. .ie n 'mc \s12\(br\s0
  130. .el .nr ^v 1u
  131. ..
  132. '\"    # VE - end of vertical sidebar
  133. .de VE
  134. .ie n 'mc
  135. .el \{\
  136. .ev 2
  137. .nf
  138. .ti 0
  139. .mk ^t
  140. \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  141. .sp -1
  142. .fi
  143. .ev
  144. .\}
  145. .nr ^v 0
  146. ..
  147. '\"    # Special macro to handle page bottom:  finish off current
  148. '\"    # box/sidebar if in box/sidebar mode, then invoked standard
  149. '\"    # page bottom macro.
  150. .de ^B
  151. .ev 2
  152. 'ti 0
  153. 'nf
  154. .mk ^t
  155. .if \\n(^b \{\
  156. .\"    Draw three-sided box if this is the box's first page,
  157. .\"    draw two sides but no top otherwise.
  158. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  159. .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  160. .\}
  161. .if \\n(^v \{\
  162. .nr ^x \\n(^tu+1v-\\n(^Yu
  163. \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  164. .\}
  165. .bp
  166. 'fi
  167. .ev
  168. .if \\n(^b \{\
  169. .mk ^y
  170. .nr ^b 2
  171. .\}
  172. .if \\n(^v \{\
  173. .mk ^Y
  174. .\}
  175. ..
  176. '\"    # DS - begin display
  177. .de DS
  178. .RS
  179. .nf
  180. .sp
  181. ..
  182. '\"    # DE - end display
  183. .de DE
  184. .fi
  185. .RE
  186. .sp .5
  187. ..
  188. .HS bind cmds
  189. .BS
  190. '\" Note:  do not modify the .SH NAME line immediately below!
  191. .SH NAME
  192. bind \- Arrange for X events to invoke Tcl commands
  193. .SH SYNOPSIS
  194. \fBbind\fI windowSpec\fR
  195. .br
  196. \fBbind\fI windowSpec sequence\fR
  197. .br
  198. \fBbind\fI windowSpec sequence command\fR
  199. .br
  200. \fBbind\fI windowSpec sequence \fB+\fIcommand\fR
  201. .BE
  202.  
  203. .SH DESCRIPTION
  204. .PP
  205. If all three arguments are specified, \fBbind\fR will
  206. arrange for \fIcommand\fR (a Tcl
  207. command) to be executed whenever the sequence of events given
  208. .VS
  209. by \fIsequence\fR occurs in the window(s) identified by \fIwindowSpec\fR.
  210. .VE
  211. If \fIcommand\fR is prefixed with a ``+'', then it is appended to
  212. any existing binding for \fIsequence\fR;  otherwise \fIcommand\fR replaces
  213. the existing binding, if any.  If \fIcommand\fR
  214. is an empty string then the current binding for \fIsequence\fR
  215. is destroyed, leaving \fIsequence\fR unbound.  In all of the cases
  216. where a \fIcommand\fR argument is provided, \fBbind\fR returns
  217. an empty string.
  218. .PP
  219. If \fIsequence\fR is specified without a \fIcommand\fR, then the
  220. command currently bound to \fIsequence\fR is returned, or
  221. an empty string if there is no binding for \fIsequence\fR.  If
  222. neither \fIsequence\fR nor \fIcommand\fR is specified, then the
  223. return value is a list whose elements are all the sequences
  224. .VS
  225. for which there exist bindings for \fIwindowSpec\fR.
  226. .PP
  227. The \fIwindowSpec\fR argument selects which window(s) the binding
  228. applies to.
  229. It may have one of three forms.
  230. If \fIwindowSpec\fR is the path name for a window, then the binding
  231. applies to that particular window.
  232. If \fIwindowSpec\fR is the name of a class of widgets, then the
  233. binding applies to all widgets in that class.
  234. Lastly, \fIwindowSpec\fR may have the value \fBall\fR, in which case
  235. the binding applies to all windows in the application.
  236. .VE
  237. .PP
  238. The \fIsequence\fR argument specifies a sequence of one or more
  239. event patterns, with optional white space between the patterns.  Each
  240. event pattern may
  241. take either of two forms.  In the simplest case it is a single
  242. printing ASCII character, such as \fBa\fR or \fB[\fR.  The character
  243. may not be a space character or the character \fB<\fR.  This form of
  244. pattern matches a \fBKeyPress\fR event for the particular
  245. character.  The second form of pattern is longer but more general.
  246. It has the following syntax:
  247. .DS C
  248. \fB<\fImodifier-modifier-type-detail\fB>\fR
  249. .DE
  250. The entire event pattern is surrounded by angle brackets.
  251. Inside the angle brackets are zero or more modifiers, an event
  252. type, and an extra piece of information (\fIdetail\fR) identifying
  253. a particular button or keysym.  Any of the fields may be omitted,
  254. as long as at least one of \fItype\fR and \fIdetail\fR is present.
  255. The fields must be separated by white space or dashes.
  256. .LP
  257. Modifiers may consist of any of the values in the following list:
  258. .DS
  259. .ta 6c
  260. \fBControl\fR    \fBAny\fR
  261. \fBShift\fR    \fBDouble\fR    
  262. \fBLock\fR    \fBTriple\fR
  263. .VS
  264. \fBButton1, B1\fR    \fBMod1, M1, Meta, M\fR    
  265. \fBButton2, B2\fR    \fBMod2, M2, Alt\fR
  266. .VE
  267. \fBButton3, B3\fR    \fBMod3, M3\fR
  268. \fBButton4, B4\fR    \fBMod4, M4\fR
  269. \fBButton5, B5\fR    \fBMod5, M5\fR
  270. .DE
  271. Where more than one value is listed, separated by commas, the values
  272. are equivalent.   All of the modifiers except \fBAny\fR,
  273. \fBDouble\fR, and \fBTriple\fR have
  274. the obvious X meanings.  For example, \fBButton1\fR requires that
  275. button 1 be depressed when the event occurs.  Under normal conditions
  276. the button and modifier state at the time of the event must
  277. match exactly those specified in the \fBbind\fR command.  If
  278. no modifiers are specified, then events will match only if no modifiers
  279. are present.  If the \fBAny\fR modifier is specified, then additional
  280. modifiers may be present besides those specified explicitly.  For
  281. example, if button 1 is pressed while the shift and control keys
  282. are down, the specifier \fB<Any-Control-Button-1>\fR will match
  283. the event, but the specifier \fB<Control-Button-1>\fR will not.
  284. .LP
  285. The \fBDouble\fR and \fBTriple\fR modifiers are a convenience
  286. for specifying double mouse clicks and other repeated
  287. events. They cause a particular event pattern to be
  288. repeated 2 or 3 times, and also place a time and space requirement
  289. on the sequence:  for a sequence of events to match a \fBDouble\fR
  290. or \fBTriple\fR pattern, all of the events must occur close together
  291. in time and without substantial mouse motion in between.
  292. For example, \fB<Double-Button-1>\fR
  293. is equivalent to \fB<Button-1><Button-1>\fR with the extra
  294. time and space requirement.
  295. .LP
  296. The \fItype\fR field may be any of the standard X event types, with a
  297. few extra abbreviations.  Below is a list of all the valid types;
  298. where two name appear together, they are synonyms.
  299. .DS C
  300. .ta 5c 10c
  301. \fBButtonPress, Button    Expose    Leave
  302. ButtonRelease    FocusIn    Map
  303. Circulate    FocusOut    Property
  304. CirculateRequest    Gravity    Reparent
  305. Colormap    Keymap    ResizeRequest
  306. Configure    KeyPress, Key    Unmap
  307. .VS
  308. .VE
  309. ConfigureRequest    KeyRelease    Visibility
  310. Destroy    MapRequest
  311. Enter    Motion\fR
  312. .DE
  313. .LP
  314. The last part of a long event specification is \fIdetail\fR.  In the
  315. case of a \fBButtonPress\fR or \fBButtonRelease\fR event, it is the
  316. number of a button (1-5).  If a button number is given, then only an
  317. event on that particular button will match;  if no button number is
  318. given, then an event on any button will match.  Note:  giving a
  319. specific button number is different than specifying a button modifier;
  320. in the first case, it refers to a button being pressed or released,
  321. while in the second it refers to some other button that is already
  322. depressed when the matching event occurs.  If a button
  323. number is given then \fItype\fR may be omitted:  if will default
  324. to \fBButtonPress\fR.  For example, the specifier \fB<1>\fR
  325. is equivalent to \fB<ButtonPress-1>\fR.
  326. .LP
  327. If the event type is \fBKeyPress\fR or \fBKeyRelease\fR, then
  328. \fIdetail\fR may be specified in the form of an X keysym.  Keysyms
  329. are textual specifications for particular keys on the keyboard;
  330. they include all the alphanumeric ASCII characters (e.g. ``a'' is
  331. the keysym for the ASCII character ``a''), plus descriptions for
  332. non-alphanumeric characters (``comma'' is the keysym for the comma
  333. character), plus descriptions for all the non-ASCII keys on the
  334. keyboard (``Shift_L'' is the keysm for the left shift key, and
  335. ``F1'' is the keysym for the F1 function key, if it exists).  The
  336. complete list of keysyms is not presented here;  it should be
  337. available in other X documentation.  If necessary, you can use the
  338. \fB%K\fR notation described below to print out the keysym name for
  339. an arbitrary key.  If a keysym \fIdetail\fR is given, then the
  340. \fItype\fR field may be omitted;  it will default to \fBKeyPress\fR.
  341. For example, \fB<Control-comma>\fR is equivalent to
  342. \fB<Control-KeyPress-comma>\fR.  If a keysym \fIdetail\fR is specified
  343. then the \fBShift\fR modifier need not be specified and will be
  344. ignored if specified:  each keysym already implies a particular
  345. state for the shift key.
  346. .LP
  347. The \fIcommand\fR argument to \fBbind\fR is a Tcl command string,
  348. which will be executed whenever the given event sequence occurs.
  349. \fICommand\fR will be executed in the same interpreter that the
  350. \fBbind\fR command was executed in.  If \fIcommand\fR contains
  351. any \fB%\fR characters, then the command string will not be
  352. executed directly.  Instead, a new command string will be
  353. generated by replacing each \fB%\fR, and the character following
  354. it, with information from the current event.  The replacement
  355. depends on the character following the \fB%\fR, as defined in the
  356. list below.  Unless otherwise indicated, the
  357. .VS
  358. replacement string is the decimal value of the given field from
  359. the current event.
  360. .VE
  361. Some of the substitutions are only valid for
  362. certain types of events;  if they are used for other types of events
  363. the value substituted is undefined.
  364. .TP
  365. \fB%%\fR
  366. Replaced with a single percent.
  367. .TP
  368. \fB%#\fR
  369. The number of the last client request processed by the server
  370. (the \fIserial\fR field from the event).  Valid for all event
  371. types.
  372. .TP
  373. \fB%a\fR
  374. The \fIabove\fR field from the event.
  375. Valid only for \fBConfigureNotify\fR events.
  376. .TP
  377. \fB%b\fR
  378. The number of the button that was pressed or released.  Valid only
  379. for \fBButtonPress\fR and \fBButtonRelease\fR events.
  380. .TP
  381. \fB%c\fR
  382. The \fIcount\fR field from the event.  Valid only for \fBExpose\fR,
  383. \fBGraphicsExpose\fR, and \fBMappingNotify\fR events.
  384. .TP
  385. \fB%d\fR
  386. The \fIdetail\fR field from the event.  The \fB%d\fR is replaced by
  387. a string identifying the detail.  For \fBEnterNotify\fR,
  388. \fBLeaveNotify\fR, \fBFocusIn\fR, and \fBFocusOut\fR events,
  389. the string will be one of the following:
  390. .RS
  391. .DS
  392. .ta 6c
  393. \fBNotifyAncestor    NotifyNonlinearVirtual
  394. NotifyDetailNone    NotifyPointer
  395. NotifyInferior    NotifyPointerRoot
  396. NotifyNonlinear    NotifyVirtual\fR
  397. .DE
  398. For \fBConfigureRequest\fR events, the substituted string will be
  399. one of the following:
  400. .DS
  401. .ta 6c
  402. \fBAbove    Opposite
  403. Below    TopIf
  404. BottomIf\fR
  405. .DE
  406. For events other than these, the substituted string is undefined.
  407. .RE
  408. .TP
  409. \fB%f\fR
  410. The \fIfocus\fR field from the event (\fB0\fR or \fB1\fR).  Valid only
  411. for \fBEnterNotify\fR and \fBLeaveNotify\fR events.
  412. .TP
  413. \fB%h\fR
  414. The \fIheight\fR field from the event.  Valid only for \fBConfigure\fR,
  415. \fBConfigureNotify\fR, \fBExpose\fR, \fBGraphicsExpose\fR, and
  416. \fBResizeRequest\fR events.
  417. .TP
  418. \fB%k\fR
  419. The \fIkeycode\fR field from the event.  Valid only for \fBKeyPress\fR
  420. and \fBKeyRelease\fR events.
  421. .TP
  422. \fB%m\fR
  423. The \fImode\fR field from the event.  The substituted string is one of
  424. \fBNotifyNormal\fR, \fBNotifyGrab\fR, \fBNotifyUngrab\fR, or
  425. \fBNotifyWhileGrabbed\fR.  Valid only for \fBEnterWindow\fR,
  426. \fBFocusIn\fR, \fBFocusOut\fR, and \fBLeaveWindow\fR events.
  427. .TP
  428. \fB%o\fR
  429. The \fIoverride_redirect\fR field from the event.  Valid only for
  430. \fBCreateNotify\fR, \fBMapNotify\fR, \fBReparentNotify\fR,
  431. and \fBConfigureNotify\fR events.
  432. .TP
  433. \fB%p\fR
  434. The \fIplace\fR field from the event, substituted as one of the
  435. strings \fBPlaceOnTop\fR or \fBPlaceOnBottom\fR.  Valid only
  436. for \fBCirculateNotify\fR and \fBCirculateRequest\fR events.
  437. .TP
  438. \fB%s\fR
  439. The \fIstate\fR field from the event.  For \fBButtonPress\fR,
  440. \fBButtonRelease\fR, \fBEnterNotify\fR, \fBKeyPress\fR, \fBKeyRelease\fR,
  441. \fBLeaveNotify\fR, and \fBMotionNotify\fR events,
  442. .VS
  443. a decimal string
  444. .VE
  445. is substituted.  For \fBVisibilityNotify\fR, one of the strings
  446. \fBVisibilityUnobscured\fR, \fBVisibilityPartiallyObscured\fR,
  447. and \fBVisibilityFullyObscured\fR is substituted.
  448. .TP
  449. \fB%t\fR
  450. The \fItime\fR field from the event.  Valid only for events that
  451. contain a \fItime\fR field.
  452. .TP
  453. \fB%v\fR
  454. The \fIvalue_mask\fR field from the event.  Valid only for
  455. \fBConfigureRequest\fR events.
  456. .TP
  457. \fB%w\fR
  458. The \fIwidth\fR field from the event.  Valid only for
  459. \fBConfigure\fR, \fBConfigureRequest\fR, \fBExpose\fR,
  460. \fBGraphicsExpose\fR, and \fBResizeRequest\fR events.
  461. .TP
  462. \fB%x\fR
  463. The \fIx\fR field from the event.  Valid only for events containing
  464. an \fIx\fR field.
  465. .TP
  466. \fB%y\fR
  467. The \fIy\fR field from the event.  Valid only for events containing
  468. a \fIy\fR field.
  469. .TP
  470. \fB%A\fR
  471. Substitutes the ASCII character corresponding to the event, or
  472. the empty string if the event doesn't correspond to an ASCII character
  473. (e.g. the shift key was pressed).  \fBXLookupString\fR does all the
  474. work of translating from the event to an ASCII character.
  475. Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
  476. .TP
  477. \fB%B\fR
  478. The \fIborder_width\fR field from the event.  Valid only for
  479. \fBConfigureNotify\fR and \fBCreateWindow\fR events.
  480. .TP
  481. \fB%D\fR
  482. The \fIdisplay\fR field from the event.  Valid for all event types.
  483. .TP
  484. \fB%E\fR
  485. The \fIsend_event\fR field from the event.  Valid for all event types.
  486. .TP
  487. \fB%K\fR
  488. The keysym corresponding to the event, substituted as a textual
  489. string.  Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
  490. .TP
  491. \fB%N\fR
  492. The keysym corresponding to the event, substituted as
  493. .VS
  494. a decimal
  495. .VE
  496. number.  Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
  497. .TP
  498. \fB%R\fR
  499. The \fIroot\fR window identifier from the event.  Valid only for
  500. events containing a \fIroot\fR field.
  501. .TP
  502. \fB%S\fR
  503. The \fIsubwindow\fR window identifier from the event.  Valid only for
  504. events containing a \fIsubwindow\fR field.
  505. .TP
  506. \fB%T\fR
  507. The \fItype\fR field from the event.  Valid for all event types.
  508. .TP
  509. \fB%W\fR
  510. The path name of the window to which the event was reported (the
  511. \fIwindow\fR field from the event).  Valid for all event types.
  512. .TP
  513. \fB%X\fR
  514. The \fIx_root\fR field from the event.  Valid only for
  515. \fBButtonPress\fR, \fBButtonRelease\fR, \fBKeyPress\fR, \fBKeyRelease\fR,
  516. and \fBMotionNotify\fR events.
  517. .TP
  518. \fB%Y\fR
  519. The \fIy_root\fR field from the event.  Valid only for
  520. \fBButtonPress\fR, \fBButtonRelease\fR, \fBKeyPress\fR, \fBKeyRelease\fR,
  521. and \fBMotionNotify\fR events.
  522. .LP
  523. If the replacement string
  524. .VS
  525. for a %-replacement contains characters that are interpreted
  526. specially by the Tcl parser (such as backslashes or square
  527. brackets or spaces) additional backslashes are added
  528. during replacement so that the result after parsing is the original
  529. replacement string.
  530. For example, if \fIcommand\fR is
  531. .DS
  532. \fBinsert\0%A\fR
  533. .DE
  534. and the character typed is an open square bracket, then the command
  535. actually executed will be
  536. .DS
  537. \fBinsert\0\e[\fR
  538. .DE
  539. This will cause the \fBinsert\fR to receive the original replacement
  540. string (open square bracket) as its first argument.
  541. If the extra backslash hadn't been added, Tcl would not have been
  542. able to parse the command correctly.
  543. .VE
  544. .LP
  545. At most one binding will trigger for any given X event.
  546. If several bindings match the recent events, the most specific binding
  547. is chosen and its command will be executed.
  548. The following tests are applied, in order, to determine which of
  549. several matching sequences is more specific:
  550. .VS
  551. (a) a binding whose \fIwindowSpec\fR names a particular window is
  552. more specific than a binding for a class,
  553. which is more specific than a binding whose \fIwindowSpec\fR is
  554. \fBall\fR;
  555. .VE
  556. (b) a longer sequence (in terms of number
  557. of events matched) is more specific than a shorter sequence;
  558. (c) an event pattern that specifies a specific button or key is more specific
  559. than one that doesn't;  (e) an event pattern that requires a particular
  560. modifier is more specific than one that doesn't require the modifier;
  561. (e) an event pattern specifying the \fBAny\fR modifier is less specific
  562. than one that doesn't.  If the matching sequences contain more than
  563. one event, then tests (c)-(e) are applied in order from the most
  564. recent event to the least recent event in the sequences.  If these
  565. tests fail to determine a winner, then the most recently registered
  566. sequence is the winner.
  567. .LP
  568. If an X event does not match any of the existing bindings, then the
  569. event is ignored (an unbound event is not considered to be an error).
  570. .LP
  571. When a \fIsequence\fR specified in a \fBbind\fR command contains
  572. more than one event pattern, then its command is executed whenever
  573. the recent events (leading up to and including the current event)
  574. match the given sequence.  This means, for example, that if button 1 is
  575. clicked repeatedly the sequence \fB<Double-ButtonPress-1>\fR will match
  576. each button press but the first.  Extraneous \fBButtonRelease\fR,
  577. .VS
  578. \fBKeyRelease\fR, \fBMotionNotify\fR, \fBGraphicsExpose\fR, and
  579. \fBNoExpose\fR events are ignored if they
  580. .VE
  581. would otherwise prevent a binding from matching recent events.  Thus,
  582. \fB<Double-ButtonPress-1>\fR will match a sequence of presses of button 1,
  583. even though there will be \fBButtonRelease\fR events (and possibly
  584. \fBMotionNotify\fR events) between the \fBButtonPress\fR events.
  585. In addition, if several \fBMotionNotify\fR events occur in a row, only
  586. the last one is used for purposes of matching binding sequences.
  587. .LP
  588. If an error occurs in executing the command for a binding then the
  589. \fBtkerror\fR mechanism is used to report the error.
  590. .VS
  591. The command will be executed at global level (outside the context
  592. of any Tcl procedure).
  593. .VE
  594.  
  595. .SH "SEE ALSO"
  596. tkerror
  597.  
  598. .SH KEYWORDS
  599. form, manual
  600.